/**
 *  定义多个可以直接更改state里面数据的方法
 * 
 * 
*/

import {
RECEIVE_ADDRESS,
RECEIVE_CATEGORYS, 
RECEIVE_SHOPS,
RECEIVE_USER_INFO,
RESET_USER_INFO
} from './mutation-types'



export default {

    //5k 的代码
    [RECEIVE_ADDRESS](state, data) {
        // console.log(data)
        state.address = data.address

    },
    [RECEIVE_CATEGORYS](state, data) {
        state.categorys = data.categorys

    },
    [RECEIVE_SHOPS](state, data) {
        state.shops = data.shops

    },

    //8k的代码
    // [RECEIVE_ADDRESS](state ,{address}) {
    //     state.address=address

    // },
    // [RECEIVE_CATEGORYS](state ,{categorys}) {
    //     state.categorys=categorys

    // },
    // [RECEIVE_SHOPS](state ,{shops}) {
    //     state.shops=shops

    // },

    //退出的时候清空userinfo 
    [RESET_USER_INFO](state) {
        state.userInfo = {}
        },


    //登录的时候存储 userinfo用户信息
    [RECEIVE_USER_INFO](state,{userInfo}) {
     state.userInfo=userInfo
    }    
   



}


